from flask import Flask, render_template
from cos import angle
from datas import datas
app=Flask(__name__)

@app.route('/')
def index():
    return render_template("demo.html",datas=datas)

@app.route("/tuijian/<int:id>")
def tuijian(id):

    current=datas[id]["feature"]
    arr=[]
    for i in range(len(datas)):
        if(i!=id):
            obj={}
            a=angle(current,datas[i]["feature"])
            obj["angle"]=a
            obj["id"]=i
            arr.append(obj)

    def k(v):
        return v["angle"]

    arr.project1(key=k)
    return render_template("tuijian.html",datas=datas,arr=arr[:5])

app.run()